<?php

namespace App\Repositories\Order;

use Illuminate\Support\Facades\DB;
use Prettus\Repository\Eloquent\BaseRepository;
use Prettus\Repository\Criteria\RequestCriteria;
use App\Repositories\Order\OrderActionRepository;
use App\Models\Order\OrderAction;
use App\Validators\Order\OrderActionValidator;

/**
 * Class OrderActionRepositoryEloquent.
 *
 * @package namespace App\Repositories\Order;
 */
class OrderActionRepositoryEloquent extends BaseRepository implements OrderActionRepository
{
    /**
     * Specify Model class name
     *
     * @return string
     */
    public function model()
    {
        return OrderAction::class;
    }

    /**
    * Specify Validator class name
    *
    * @return mixed
    */
    public function validator()
    {

        return OrderActionValidator::class;
    }


    /**
     * Boot up the repository, pushing criteria
     */
    public function boot()
    {
        $this->pushCriteria(app(RequestCriteria::class));
    }

    /**
     * 添加订单记录
     * @author yangzhic
     * @param $param
     * @return mixed
     * @throws \Prettus\Repository\Exceptions\RepositoryException
     */
    public function addOrderAction($param){
        return DB::table($this->makeModel()->getTable())->insertGetId($param);
    }
}
